/*
 * @Author: 阿芙
 * @Date: 2021-04-10 22:35:08
 * @LastEditTime: 2021-04-15 01:33:21
 * @LastEditors: Please set LastEditors
 * @Description: 
 * @FilePath: /ManageTemplate/src/Model/SystemModel/ResultJson.js
 */
"use strict";
const {ResultModel} = require("./ResultModel.js")
// 程序跟你开了点小玩笑
module.exports = {

    Version:"",
    /**
     * 成功的返回
     * @param {*} data 
     * @returns 
     */
    Ok:function(data){
        return new ResultModel(0,"",data,this.Version);
    },

    MegOk:function(str){
        return new ResultModel(0,str,null,this.Version);
    },

    /**
     * 公共的错误返回
     * @param {*} str 
     * @param {*} code 
     * @returns 
     */
    Error:function(str){
        return new ResultModel(500109,str,null,this.Version);
    },

    EnumError:function(Enums){
        return new ResultModel(Enums.key,Enums.value,null,this.Version);
    },

    /**
     * 删除失败
     * @returns {ResultModel}
     * @constructor
     */
    DeleteError:function(){
        return new ResultModel(500107,"删除失败",null,this.Version);
    },

    AddError:function () {
        return new ResultModel(500108,"添加失败",null,this.Version);
    },

    /**
     * 返回API请求参数错误
     * @returns 
     */
    ParamsError:function(){
        return new ResultModel(40000,"参数错误",null,this.Version);
    },
    /**
     * try 报错
     * @returns 
     */
    SystemError:function(){
        return new ResultModel(500101,"系统繁忙，请稍后再访问！",null,this.Version);
    },

    /**
     * 程序错误
     * @returns 
     */
    GUBError:function(){
        return new ResultModel(500102,"服务器来了点小差！",null,this.Version);
    },
    /**
     * 权限不足
     * @returns
     */
    AuthorityError:function(){
        return new ResultModel(600101,"亲，您的权限不足，请向管理员申请！",null,this.Version);
    },

    /**
     * 不能强制退出自己
     * @returns
     */
    QuitError:function(){
        return new ResultModel(600102,"亲，当前登录用户无法强退！",null,this.Version);
    },
    V:function(Version){
       this.Version =  Version;
       return this;
    }
}